<template>
<div>
       <el-table 
      :data="tableData"
      border
      style="width: auto">
       <el-table-column
        prop="id"
        label="商家资质"
        width="200"
        align="center">
          <template slot-scope="scope"> 
        <span v-if="scope.row.charter">
          <img width="95" :src="scope.row.charter">
        </span>                  
        </template>
      </el-table-column>
      <el-table-column
        prop="id"
        label="商家id"
        width="100"
        align="center">
      </el-table-column>
      <el-table-column
        prop="name"
        label="商户名称"
        width="200"
        align="center">
      </el-table-column>
        <el-table-column
        prop="detail"
        label="详细信息"
        width="200"
        align="center">
      </el-table-column>
      <el-table-column     
        label="操作"
        align="center"
        width="200">
        
        <template slot-scope="scope"> 
          <!-- 这些方法用于打开对话框，名字要和真正实现的方法，事件名区分 -->
          <el-button type="success" size="mini" @click="accept(scope)">通过</el-button>
          <el-button type="warning" size="mini" @click="refuse(scope)">不通过</el-button>
        
           
        </template>
      </el-table-column>
    </el-table>


    </div>
</template>
<script>
export default {
    data() {
           return{
           tableData:[], 

      }
    },
    methods:{
        accept:function(scope){
        this.$axios.get("http://localhost:8080/merchant/accept/"+scope.row.id).then(res =>{
        if(res.data.status=="SUCCESS"){
      this.tableData.splice(scope.$index,1)
         }
        
      })
        },
        refuse:function(scope){
        this.$axios.get("http://localhost:8080/merchant/refuse/"+scope.row.id).then(res =>{
        if(res.data.status=="SUCCESS"){
      this.tableData.splice(scope.$index,1)
         }
        
      })
        }
    },
     mounted(){
        this.$axios.get("http://localhost:8080/merchant/finduncheck").then(res =>{
         console.log(res.data)//ResponseResult
        console.log(res.data.data)  
        this.tableData = res.data.data
        
      })
    }
    
}
</script>
<style>
</style>